package org.example.platform.elasticsearch;

import org.example.platform.elasticsearch.entity.MyEntity;
import org.example.platform.elasticsearch.posity.MyEntityRepository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Optional;

@Service
public class MyService {
    @Resource
    MyEntityRepository myEntityRepository;

    public void saveEntity(MyEntity entity) {
        myEntityRepository.save(entity);
    }

    public Optional<MyEntity> searchEntities(String keyword) {
        // 使用repository的查询方法进行搜索操作
        return myEntityRepository.findById(keyword);
    }


}
